package com.ybkj.daijia.server.model;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.apache.shiro.crypto.hash.Sha1Hash;


public class DriverLogin extends Base {

    //有效时间（分钟）
    public static final int VALID_TIME = 10;

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private Long driverId;

    private String driverToken;

    private Date deathDate;

    private Date refreshDate;

    private Integer passError;

    private Integer codeError;

    public static String genToken(List<String> params) {

        String securityKey = "xiaoka";

        params.add(securityKey);

        Collections.sort(params);

        Sha1Hash sha1 = new Sha1Hash(params.toString());

        return sha1.toString().toLowerCase();
    }

    public Integer getCodeError() {
        if (null == codeError) {
            return 0;
        }
        return codeError;
    }

    public void setCodeError(Integer codeError) {
        this.codeError = codeError;
    }

    public Integer getPassError() {
        if (null == passError) {
            return 0;
        }
        return passError;
    }

    public void setPassError(Integer passError) {
        this.passError = passError;
    }

    public Long getDriverId() {
        return driverId;
    }

    public void setDriverId(Long driverId) {
        this.driverId = driverId;
    }

    public String getDriverToken() {
        return driverToken;
    }

    public void setDriverToken(String driverToken) {
        this.driverToken = driverToken;
    }

    public Date getDeathDate() {
        return deathDate;
    }

    public void setDeathDate(Date deathDate) {
        this.deathDate = deathDate;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}
